go to previous page   go to home page   go to next page

Answer:

Vertical Slider
sliderV = new JSlider( JSlider.VERTICAL, 
    0, 1000, 400);
sliderV.setMajorTickSpacing( 100 );
sliderV.setMinorTickSpacing(  50 );
sliderV.setPaintTicks ( true );
sliderV.setPaintLabels( true ); 

setPreferredSize()

Layout managers control the size of components, but do a better job if you indicate a preferred size. If you don't do this, a slider may have its labels and tick marks crowded together. Do this with

setPreferredSize( new Dimension( int width, int height ) )

QUESTION 7:

Suggest that a slider have a width of 50 and a height of 300:

sliderV.setPreferredSize( new Dimension(  , ) );